<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String photo = request.getParameter("photo");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'loadphoto.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>CSS/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.css">
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/external/jquery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.js"></script>
  	
  </head>
  
  <body>
  		<div id="head-search">
   	 		<span class="home-path"></span>
   	 		<span class="path-font">会员信息管理&nbsp;&nbsp;>>&nbsp;&nbsp;个人信息&nbsp;&nbsp;>>&nbsp;&nbsp;编辑头像</span>
   		</div>
   		<div class="mainbody">
   				<div style="width:160px;height:200px;">
   					<img id="pic" width="160" height="200" src="<%=basePath+photo%>">
   				</div>
   				<div class="divrow">
   					<form name="photoform" id="photoform" method="post" enctype="multipart/form-data" action="<%=basePath %>loadPhotoAction">
   						<input  type="file" name="photo" id="photo"/>
   					</form>
   				</div>
   					<button id="savephotobtn" class="wong-button-text-ui wong-button-blue">
   						<span class="wong-ui-icon wong-icon-save"></span>
   						<span >保存</span>
   					</button>
   					
   					
   		</div>
    
  </body>
  <script>
  	$(function(){
  		$("#savephotobtn").click(function(){
  			if($("#photo").val()==""){
  				alert("请选择图片！");
  				return;
  			}	
  			var file = $("#photo").val();
  			var str = file.split(".");
  			var type = str[str.length-1];
  			if(type!="jpg"){
  				alert("图片请选择jpg格式！");
  				return;
  			}
  			$("#photoform").submit();
  		});
  	});
		
  </script>
</html>
